package com.yic.module.device.dal.mysql.maintenancePlanEntry;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.maintenancePlanEntry.MaintenancePlanEntryDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.maintenancePlanEntry.vo.*;

/**
 * 设备保养项目 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MaintenancePlanEntryMapper extends BaseMapperX<MaintenancePlanEntryDO> {

    default PageResult<MaintenancePlanEntryDO> selectPage(MaintenancePlanEntryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaintenancePlanEntryDO>()
                .likeIfPresent(MaintenancePlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(MaintenancePlanEntryDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MaintenancePlanEntryDO::getType, reqVO.getType())
                .betweenIfPresent(MaintenancePlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaintenancePlanEntryDO::getId));
    }

    default List<MaintenancePlanEntryDO> selectList(MaintenancePlanEntryExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MaintenancePlanEntryDO>()
                .likeIfPresent(MaintenancePlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(MaintenancePlanEntryDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MaintenancePlanEntryDO::getType, reqVO.getType())
                .betweenIfPresent(MaintenancePlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaintenancePlanEntryDO::getId));
    }

    default PageResult<MaintenancePlanEntryDO> getMaintenancePlanEntryNotSelectPage(MaintenancePlanEntryPageReqVO reqVO, List<Long> entryIdList){
        return selectPage(reqVO, new LambdaQueryWrapperX<MaintenancePlanEntryDO>()
                .likeIfPresent(MaintenancePlanEntryDO::getName, reqVO.getName())
                .eqIfPresent(MaintenancePlanEntryDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MaintenancePlanEntryDO::getType, reqVO.getType())
                .betweenIfPresent(MaintenancePlanEntryDO::getCreateTime, reqVO.getCreateTime())
                .notInIfPresent(MaintenancePlanEntryDO::getId,entryIdList)
                .orderByDesc(MaintenancePlanEntryDO::getId));
    }
}
